﻿using System;
using System.IO;

namespace LabSolutions
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] inputNumbers = input.Split(' ');
            double x = double.Parse(input);
            double value =
                x > 2 ? Line(2, 0, 3, -1, x) : 
                x > 0 ? Circle(0, 0, 2, x, true) :
                x > -2 ? Circle(-2, 2, 2, x, false) :
                x >= -6 ? Line(-6, -1, -2, 0, x) :
                x >= -7 ? 2 :
                double.NaN;
            
            Console.Write(value.ToString("0.00000"));                       
        }

        private static double Circle(double x0, double y0, double radius, double x, bool higher)
        {
            return y0 + (higher ? 1 : -1) * Math.Sqrt(Math.Pow(radius, 2) - Math.Pow(x - x0, 2));
        }

        private static double Line(double x1, double y1, double x2, double y2, double x)
        {
            return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
        }
    }
}
